<template>
	<view class="s_step">
		<view class="s_step_list" v-for="(item,index) in thistype" :key="index">
			<view class="s_step_left">
				<view class="tit_main">{{item.year}}</view>
				<view class="s_step_main">
					<view class="tit">{{item.month}}</view>
					<view class="line" v-if="index!=thistype.length-1">
						<view class="yuan"></view>
					</view>
				</view>
			</view>
			<view class="s_step_right">

				<view v-if="item.bglx!=''">变更类型:<text>{{item.bglx}}({{item.zsbh}})</text></view>
				<view v-if="item.zczy!=''">摘要:<text>{{item.zczy}}</text></view>
				<view v-if="item.bgyy!=''">变更原因:<text>{{item.bgyy}}</text></view>
				<view class="s_step_right_line">
				</view>
			</view>
		</view>
		<view v-if="thistype.length==0" style="height: 200rpx;line-height: 200rpx;text-align: center;color: #999999;">
			{{meishuju}}
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				thistype: [],
				meishuju: '',
				thistypeNum: 0,
				dataForm: {
					currentPage: '1',
					pageSize: '10',
					sfzh: '',
					userId: ''
				},
				userInfo: {
					userId: '',
					sfzh: ''
				},
			}
		},
		computed: {
			isRealName() {
				return this.$store.state.isRealName
			},
			userid() {
				return this.$store.state.userId
			},
			sfzh() {
				return this.$store.state.sfzh
			}
		},
		created() {
			// 已认证数据加载
			this.dataForm.userId = this.userid
			this.userInfo.userId = this.userid
			this.dataForm.sfzh = this.sfzh
			this.userInfo.sfzh = this.sfzh
			this.getCerts()
			// this.getStep(this.dataForm)
		},
		methods: {
			// 证书动态
			getCerts() {
				uni.showLoading({
					title: '数据加载中...'
				})
				let _this = this
				setTimeout(function() {
					// 身份证号为空表示未实名，不能查证书状态
					if (_this.userInfo.sfzh != '') {
						_this.$myResquest.getCert(_this.userInfo).then(res => {
							if (res.data.code == 200) {
								let jsonData = JSON.parse(res.data.data)
								_this.certsList = jsonData
								// 分隔时间
								for (var i = 0; i < _this.certsList.length; i++) {
									_this.$set(_this.certsList[i], 'year', (_this.certsList[i].yxq)
										.substring(0, 4))
									_this.$set(_this.certsList[i], 'month', (_this.certsList[i].yxq)
										.substring(5, 10))
									_this.thistype.push(_this.certsList[i])
								}
								if (_this.certsList.length == 0) {
									_this.meishuju = '暂无数据信息'
								}
								uni.hideLoading()
							}
						})
					}
				}, 1000)


			},
			getStep(dataForm) {

				this.$myResquest.getCert(dataForm).then(res => {})
			},
			timeCut(name) {
				let company = name.split("-")
				return company;
			},

		}
	}
</script>

<style lang="scss" scoped>
	.s_step {
		margin: 6rpx 0;

		.s_step_list {
			box-sizing: border-box;
			display: flex;
			width: 648rpx;
			margin: 0 auto 6rpx;

			.s_step_left {
				.tit_main {
					font-size: 22rpx;
					font-family: PingFang SC, PingFang SC-Bold;
					font-weight: 700;
					text-align: left;
					color: #bebfc1;
				}

				.s_step_main {
					display: flex;
					flex-direction: column;
					align-items: center;
					height: 80%;
					min-height: 92rpx;

					.tit {
						height: 14rpx;
						font-size: 18rpx;
						font-family: PingFang SC, PingFang SC-Bold;
						font-weight: 700;
						text-align: left;
						color: #bebfc1;
					}

					.line {
						width: 2rpx;
						height: 78%;
						background: #e5e5e5;
						position: relative;
						margin-top: 14rpx;

						.yuan {
							width: 6rpx;
							height: 6rpx;
							border-radius: 50%;
							background: #e5e5e5;
							position: absolute;
							top: -6rpx;
							left: -2rpx;
						}
					}

				}
			}

			.s_step_right {
				// background: pink;
				margin-top: 4rpx;
				font-size: 25rpx;
				font-family: PingFang SC, PingFang SC-Medium;
				font-weight: 700;
				text-align: left;
				color: #5f5d5d;
				margin-left: 34rpx;
				min-width: 576rpx;
				width: 100%;

				text {
					color: #000000;
					padding-left: 10rpx;
					box-sizing: border-box;
					font-weight: 100;
				}

				.s_step_right_line {
					margin-top: 26rpx;
					width: 100%;
					height: 2rpx;
					border-bottom: 2rpx dashed #c9caca;
				}
			}
		}
	}
</style>
